<?php

class MimeType {

    private $type;
    public function getType() { return $this->type; }

    private $subtype;
    public function getSubtype() { return $this->subtype; }

    public function toString() { return $this->type . '/' . $this->subtype; }

    public function isImage() { return $this->getType() == 'image'; }

    public function __construct($type) {

        $arrChunks = explode('/', $type, 2);
        if (count($arrChunks) != 2)
            throw new Exception("Incorrect MIME tyte $type");

        list($this->type, $this->subtype) = $arrChunks;
    }
}


?>